<?php
/**
 * @var $form CActiveForm
 */
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'xep-lop-form',
    'enableAjaxValidation' => false,
    'action' => Yii::app()->createUrl('site/registerclass'),
)); ?>
<div class="form">
    <div class="row">
        <?php echo $form->label($model, 'name');?>
        <?php echo $form->textField($model, 'name');?>
        <?php echo $form->error($model, 'name');?>
    </div>
    <div class="row">
        <?php echo $form->label($model, 'email');?>
        <?php echo $form->textField($model, 'email');?>
        <?php echo $form->error($model, 'email');?>
    </div>
    <div class="row">
        <?php echo $form->label($model, 'tel');?>
        <?php echo $form->textField($model, 'tel');?>
        <?php echo $form->error($model, 'tel');?>
    </div>
    <div class="row">
        <?php echo $form->label($model, 'training_id');?>
        <?php echo $form->listBox($model, 'training_id', $list_training, array('size' => 1));?>
        <?php echo $form->error($model, 'training_id');?>
    </div>
    <div class="row">
        <?php echo $form->label($model, 'facility_id');?>
        <?php echo $form->listBox($model, 'facility_id', $list_facility, array('size' => 1));?>
        <?php echo $form->error($model, 'facility_id');?>
    </div>
    <div class="row" class="ngay">
        <?php echo $form->label($model, 'ngay');?>
        <?php //echo $form->checkBoxList($model, 'ngay', array(2, 3, 4, 5, 6, 7, 'cn'));?>
        <input type="hidden" name="XepLop[ca]" value="" id="ytXepLop_ca">
        <span id="XepLop_ngay"><input type="checkbox" name="XepLop[ngay][]" value="0" id="XepLop_ngay_0"> <label for="XepLop_ngay_0">2</label>
<input type="checkbox" name="XepLop[ngay][]" value="1" id="XepLop_ngay_1"> <label for="XepLop_ngay_1">3</label>
<input type="checkbox" name="XepLop[ngay][]" value="2" id="XepLop_ngay_2"> <label for="XepLop_ngay_2">4</label>
<input type="checkbox" name="XepLop[ngay][]" value="3" id="XepLop_ngay_3"> <label for="XepLop_ngay_3">5</label><br/>
<input type="checkbox" name="XepLop[ngay][]" value="4" id="XepLop_ngay_4"> <label for="XepLop_ngay_4">6</label>
<input type="checkbox" name="XepLop[ngay][]" value="5" id="XepLop_ngay_5"> <label for="XepLop_ngay_5">7</label>
<input type="checkbox" name="XepLop[ngay][]" value="6" id="XepLop_ngay_6"> <label for="XepLop_ngay_6">cn</label></span>
        <?php echo $form->error($model, 'ngay');?>
    </div>
    <div class="row" class="ngay">
        <?php echo $form->label($model, 'ca');?>
        <?php //echo $form->checkBoxList($model, 'ca',array('sáng','chiều','tối'));?>
        <input type="hidden" name="XepLop[ca]" value="" id="ytXepLop_ca">
        <span id="XepLop_ca"><input type="checkbox" name="XepLop[ca][]" value="0" id="XepLop_ca_0"> <label
            for="XepLop_ca_0">sáng</label>
<input type="checkbox" name="XepLop[ca][]" value="1" id="XepLop_ca_1"> <label for="XepLop_ca_1">chiều</label>
<input type="checkbox" name="XepLop[ca][]" value="2" id="XepLop_ca_2"> <label for="XepLop_ca_2">tối</label></span>
        <?php echo $form->error($model, 'ca');?>
    </div>
    <div class="row">
        <?php echo CHtml::ajaxSubmitButton('Đăng ký', Yii::app()->createUrl('site/registerclass'), array('success' => 'js: function(data) {
                        if(data){
                        var obj = JSON.parse(data);
                        if(obj.ok){
                            alert("Bạn đã đăng ký thành công. Vui lòng kiểm tra email.");
                            $("#regDialog").dialog("close");
                        }
                        }

                    }'));?>
    </div>

</div>
<?php $this->endWidget(); ?>
